var vue=new Vue({
    el:'#cqr',
    data:{
        username:'',
        password:''
    },
    methods:{
        register:function () {
            if(vue.username==''){
                alert("用户名不能为空！")
                return;
            }
            if(vue.password==''){
                alert("密码不能为空！");
                return;
            }
            if(vue.username.length>16){
                alert("请输入长度小于16的的用户名!")
                return;
            }
            if(vue.password.length>16){
                alert("请输入长度小于16的的密码!");
                return;
            }
            var data={
                username:vue.username,
                password:vue.password
            };
            $.ajax({
                type: "POST",
                url: "service/registerService.jsp",
                data: data,
                dataType: "JSON",
                success: function(msg){
                    if (msg.status=='success'){
                        window.location.href='login.jsp';
                        alert(msg.message);
                    }else {
                        alert(msg.message);
                    }
                },
                error:function (mes) {
                    //alert(message);
                }
            });
        }
    }
})